﻿using System.IO;
using System.Text;

namespace Zinnia.Common
{
    /// <summary>
    /// 文件帮助类
    /// </summary>
    public static class FileHelper
    {
        /// <summary>
        /// 读取文件
        /// </summary>
        /// <param name="relativePath">相对应用程序路径</param>
        /// <param name="encode">编码格式</param>
        /// <returns></returns>
        public static string ReadFileText(string relativePath, Encoding encode)
        {
            return File.ReadAllText(DirectoryHelper.GetApplicationRootPath() + relativePath, encode);
        }
        public static string ReadFileText(string relativePath)
        {
            return File.ReadAllText(DirectoryHelper.GetApplicationRootPath() + relativePath, Encoding.UTF8);
        }
    }
}
